const state = {
  token: localStorage.getItem('pz_token') || '',
  userObj: localStorage.getItem('pz_userInfo')
    ? JSON.parse(localStorage.getItem('pz_userInfo'))
    : '',
}

const mutations = {
  // 添加token
  recordToken(state, value) {
    localStorage.setItem('pz_token', value)
    state.token = value
  },
  // 添加用户信息
  recordUser(state, value) {
    localStorage.setItem('pz_userInfo', value)
    state.userObj = value
  },
}

export default {
  state,
  mutations,
}
